<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
    <div th:fragment="footer-content">
        <footer class="footer text-right">
            <!--         © JOJO  <a th:href="void(0)" target="_blank"></a><div class=""></div> -->
        </footer>
    </div>
    <body th:fragment="footer">
        <!-- jQuery -->
        <script src="/plugins/jquery/jquery.min.js"></script>
        <!-- Bootstrap 4 -->
        <script src="/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
        <!-- DataTables  & Plugins -->
        <script src="/plugins/datatables/jquery.dataTables.min.js"></script>
        <script src="/plugins/datatables-bs4/js/dataTables.bootstrap4.min.js"></script>
        <script src="/plugins/datatables-responsive/js/dataTables.responsive.min.js"></script>
        <script src="/plugins/datatables-responsive/js/responsive.bootstrap4.min.js"></script>
        <script src="/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
        <script src="/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
<!--        <script src="/plugins/jszip/jszip.min.js"></script>-->
<!--        <script src="/plugins/pdfmake/pdfmake.min.js"></script>-->
<!--        <script src="/plugins/pdfmake/vfs_fonts.js"></script>-->
        <script src="/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
        <script src="/plugins/datatables-buttons/js/buttons.print.min.js"></script>
        <script src="/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>
        <script src="https://cdn.bootcdn.net/ajax/libs/datatables.net-select-bs4/1.6.2/select.bootstrap4.min.js"></script>
        <script src="/js/bootstrap-treeview.js"></script>
        <script src="/plugins/sweetalert2/sweetalert2.js"></script>
        <script src="/plugins/toastr/toastr.min.js"></script>

        <!-- AdminLTE App -->
        <script src="/dist/js/adminlte.min.js"></script>
        <script src="/js/jquery.spring-friendly.js"></script>
        <!-- AdminLTE for demo purposes -->
        <!--        <script src="/dist/js/demo.js"></script>-->
<!--        <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>-->
        <script src="/js/laydate.js"></script>
        <script src="/js/base.js"></script>
        <script src="/js/city-picker.data.js"></script>
        <script src="/js/city-picker.js"></script>
        <script>
            const tale = new $.tale();
            const Toast = Swal.mixin({
                toast: true,
                position: 'center',
                showConfirmButton: false,
                timer: 1500
            });

            const Confirm = Swal.mixin({
                showConfirmButton: false,
                showCancelButton: true,
                showConfirmButton: true,
                reverseButtons: true,
                confirmButtonText: '确认',
                cancelButtonText: '取消',
            });
            $("#adminModal").on("shown.bs.modal", function () {
                $("#adminForm")[0].reset();

            });
            function editAdmin() {
                let data = $('#adminForm').serializeArray();
                console.log(data);
                Confirm.fire({
                    title: '确认编辑？',
                    preConfirm: function () {
                        tale.post({
                            url: '/admin/sysUser/edit',
                            data: data,
                            success: function (result) {
                                if (result.code == 200) {

                                    Toast.fire({
                                        icon: 'success',
                                        title: '操作成功,返回登录'
                                    })
                                    // $('#adminModal').modal('hide');
                                    window.location.replace('/admin/logout')
                                    // window.location.href = '/';
                                } else {
                                    Toast.fire({
                                        icon: 'error',
                                        title: result.msg || '操作失败'
                                    })
                                }
                            },
                            error: function (e) {
                                Toast.fire({
                                    icon: 'error',
                                    title: e.msg || '操作失败'
                                })
                            }
                        })
                    }
                })
            }
        </script>
    </body>
</html>